The perfect layout for a three column blog

I have always wanted the perfect three column design for my blog. I stumbled across this web site and I think this is the probably as good as it gets.

Holy Grail 3 column liquid-layout: No Quirks Mode, No IE Conditional Comments

This is by Matthew James Taylor and I have to say I am very impressed.

I renamed the CSS id’s to something easier for me to remember. I added a navigation bar, and another div to give a white space on the right and left.

Here is the basic html:

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
  <title>Site Title</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 
  <style type="text/css">
  body {
      margin:0;
      padding:0;
  }
 
  #ContainerMain {}
 
  a {
      /* color:#369; */
      text-decoration:none;
  }
 
  a:hover {
      text-decoration: underline;
  }
 
  h1, h2, h3 {
      margin:.8em 0 .2em 0;
      padding:0;
  }
 
  p {
      margin:.4em 0 .8em 0;
      padding:0;
  }
 
  img {
      margin:10px 0 5px;
  }
 
  #Header {
      float:left;
      width:100%;
      padding:0;
      margin:0;
      border-bottom:1px solid #000;
      background: #CCC;
      color: #FFF;
  }
 
  #Header p {
      padding:.5em 15px    .2em 15px;
      margin:0;
  }
 
  #Header h1  {
      padding:.2em 15px;
      margin:0;
  }
 
  #Header h2  {
      padding:.2em 15px    .7em 15px;
      margin:0;
  }
 
  #NavBar {
      float:left;
      width:100%;
      padding:0;
      margin:0;
      border-bottom:1px solid #000;
      background: #EEE;
      color: #FFF;
 
  }
 
  #ContainerColumns {
      margin-left: 20px;
      margin-right: 20px;
  }
 
  #ContainerLeft {
      position:relative;  /* This fixes the IE7 overflow hidden bug and stops the layout jumping out of place */
      clear:both;
      float:left;
      width:100%;         /* width of whole page */
      overflow:hidden;    /* This chops off any overhanging divs */
      background:#ffd8b7; /* Left column background colour */
  }
 
  #ContainerMiddle {
      float:left;
      width:200%;
      position:relative;
      left:200px;
      background:#EEE;    /* Centre column background colour */
  }
 
  #ContainerRight {
      float:left;
      width:100%;
      position:relative;
      left:50%;
      margin-left:-400px;
      background:#ff9;    /* Right column background colour */
  }
 
  #ColumnMiddlewrap {
      float:right;
      width:50%;
      position:relative;
      right:100%;
  }
 
  #ColumnMiddlepad {
      margin:0 15px 0 415px;
      overflow:hidden;
  }
 
  #ColumnMiddle {
      width:100%;
      overflow:hidden;
  }
 
  #ColumnLeft {
      float:left;
      width:170px;
      position:relative;
      margin-left:-50%;
      left:215px;
      overflow:hidden;
  }
 
  #ColumnRight {
      float:left;
      width:170px;
      position:relative;
      left:15px;
      overflow:hidden;
  }
 
  #footer {
      text-align: center;
      clear:both;
      float:left;
      width:100%;
      padding:0;
      margin:0;
      border-top:1px solid #000;
      background: #CCC;
  }
 
  #footer p {
      margin: 0px;
      padding: 0px;
      font-size: 12px;
  }
  </style>
</head>
<body>
  <div id="ContainerMain">
    <div id="Header">
      <h1>Site Name</h1>
      <h2>Site Tag Line</h2>
    </div>
    <div id="NavBar">Home</div>
    <div id="ContainerColumns">
      <div id="ContainerLeft">
    <div id="ContainerMiddle">
      <div id="ContainerRight">
        <div id="ColumnMiddlewrap">
          <div id="ColumnMiddlepad">
        <div id="ColumnMiddle">
          <!-- Column 1 start -->
          <p>Middle Column</p>
          <p><a href="www.rhyous.com">http://www.Rhyous.com</a></p>
          <h1>Heading 1</h1>
          <h2>Heading 2</h2>
          <h3>Heading 3</h3>
          <!-- Column 1 end -->
        </div>
          </div>
        </div>
        <div id="ColumnLeft">
          <!-- Column 2 start -->
          <p>Left Column</p>
          <!-- Column 2 end -->
        </div>
        <div id="ColumnRight">
          <!-- Column 3 start -->
          <p>Right Column</p>
          <!-- Column 3 end -->
        </div>
      </div>
    </div>
      </div>
    </div>
    <div id="footer">
      <p>Footer</p>
      <p>This is where you put your footer stuff.</p>
      <p>
      <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" />
    </a>
      </p>
    </div>
  </div>
</body>
</html>

One Comment

  1. [...] Similar Posts The perfect layout for a three column blog [...]

Leave a Reply

How to post code in comments?